'use strict';

const RouterService = require('./base');

class BannerService extends RouterService {
  constructor(ctx) {
    super(ctx, 'Product');
  }

  pageOrder() {
    return [
        ['sort', 'ASC'],
        ['create_time', 'DESC']
    ];
  }

  listOrder() {
    return [
        ['sort', 'ASC'],
        ['create_time', 'DESC']
    ];
  }

    getPageInclude() {
        return [
            {
                model: this.ctx.model.Comment,
                as: 'comments',
            }
        ]
    }
    getOneInclude() {
        return [
            {
                model: this.ctx.model.Comment,
                as: 'comments',
                where: {
                    status: 1,
                },
                required: false,
                include: [
                    {
                        model: this.ctx.model.User,
                        as: 'user'
                    }
                ]
            }
        ]
    }
}

module.exports = BannerService;
